function to (promiseObj) {
  const newP = promiseObj
    .then(res => {
      return [null, res]
    })
    .catch(err => {
      return [err, null]
    })

  return newP
}

export default to // 导出to函数

// 极简写法
// export default promiseObj => promiseObj.then(res => [null, res]).catch(err => [err, null])
